const SYSTEM_INFO = uni.getSystemInfoSync();

export const getStatusBarHeight = () => SYSTEM_INFO.statusBarHeight || 0;

export const getTitleBarHeight = () => {
	// #ifdef MP
	if (uni.getMenuButtonBoundingClientRect()) {
		let {
			top,
			height
		} = uni.getMenuButtonBoundingClientRect();
		return (top - getStatusBarHeight()) * 2 + height;
	} else {
		return 44;
	}
	// #endif
	// #ifndef MP
	return 44;
	// #endif

}

export const screenHeight = () => SYSTEM_INFO.screenHeight;

export const getNavBarHeight = () => getStatusBarHeight() + 44;

export const getLeftIconLeft = () => {
	// #ifdef MP-TOUTIAO
	let {
		leftIcon: {
			left,
			width
		}
	} = tt.getMenuButtonBoundingClientRect();
	return left + parseInt(width);
	// #endif
	return 0;
}

export const platForm = () => SYSTEM_INFO.platform;

export const bottomTabbarHeight = () => {
	screenHeight() - getNavBarHeight() - SYSTEM_INFO.safeArea.height;
}


export const getAppVersion = () => {
	// 获取当前app的版本
	const systemInfo = uni.getSystemInfoSync();
	// 应用程序版本号
	// 条件编译，只在APP渲染
	// #ifdef APP
	return systemInfo.appWgtVersion;
	// #endif

}

export const isIOSPlatFrom = ()=>{
	const platform = SYSTEM_INFO.platform;
	if(platform ==='ios'){
		return true
	}else{
		return false
	}
}